package com.fance.highlight_springmvc4.web.ch4_3;

import com.fance.highlight_springmvc4.domain.DemoObj;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fance
 * @date 18-5-6 下午2:19
 */
@RestController
@RequestMapping("/rest")
public class DemoRestController {

    @RequestMapping(value = "/getjson",produces = {"application/json;charset=UTF-8"})
    public DemoObj getJson(DemoObj demoObj) {
        return new DemoObj(demoObj.getId() + 1, demoObj.getName() + "yy");
    }

@RequestMapping(value = "/getxml",produces = {"application/xml;charset=UTF-8"})
    public DemoObj getXml(DemoObj demoObj) {
        return new DemoObj(demoObj.getId() + 1, demoObj.getName() + "yy");
    }
}
